#include<iostream>
#include<string>
#include<stack>
using namespace std;
int main()
{
	string str;
	cin >> str;
	stack<int> st;
	for (int i = 0;i < str.size();i++)
	{
		if (str[i] == '+' || str[i] == '/' || str[i] == '*' || str[i] == '-')
		{
			int right = st.top();
			st.pop();
			int left = st.top();
			st.pop();
			int ret = 0;
			switch (str[i])
			{
			case '+':
				ret = left + right;
				break;
			case '-':
				ret = left - right;
				break;
			case '*':
				ret = left * right;
				break;
			case '/':
				ret = left / right;
				break;
			}
			st.push(ret);
		}
		else if (str[i] == '.') continue;
		else if (str[i] == '@')break;
		else
		{
			int len = 0;
			for (int j = i;j < str.size();j++)
			{
				if (str[j] != '.')len++;
				else break;
			}
			string tmp = str.substr(i, len);
			int in = stoi(tmp);
			st.push(in);
			i += len - 1;
		}
	}
	cout << st.top();
	return 0;
}